// slp.c

#include <sys/types.h>
#include <stdio.h>

void print_usage();

int main(int argc, char* argv[])
{
	int sleepsec = 0;

	if( 1 == argc )
	{
		// print usage
		print_usage();
		return 0;
	}

	int i = 0;
	// parse options
	for(i=1; i<argc; i++)
	{
		if( '-' == argv[i][0] )
		{
			// option
			if( !strcmp("-h", argv[i]) || !strcmp("--help", argv[i]) )
			{
				print_usage();
				return;
			}
		}
		else
		{
			sleepsec = atoi(argv[i]);
		}
	}

	sleep(sleepsec);
	return 0;
}

void print_usage()
{
	printf(
"usage: sleep N\n \
desc: pauses a process for N seconds\n"
	);
}
